package cii_lib_graph;

import java.util.Vector;

import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.WindowConstants;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import testy.TestHardware;
import cii_functions.FCII_IDENTIFICATOR;
import cii_opto.CCII_MUX_DATA_TRANSCEIVER;
import cii_opto.CII_OPTO_cfg_tab;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class GInterfacesPanel extends javax.swing.JPanel {
	
	private static final Logger log = LoggerFactory
			.getLogger(GInterfacesPanel.class);
	
	private JPanel jPanel1;
	private Vector<GInterfaceTerminal> gInterfaceTerminals = new Vector<GInterfaceTerminal>();
	private JScrollPane jScrollPane;
	private int num_int=1;
	/**
	* Auto-generated main method to display this 
	* JPanel inside a new JFrame.
	*/
	public static void main(String[] args) {
		TestHardware th = new TestHardware();
		CCII_MUX_DATA_TRANSCEIVER glob = new CCII_MUX_DATA_TRANSCEIVER(CII_OPTO_cfg_tab.ITAB,0,th,null);
		FCII_IDENTIFICATOR cid ;
		cid = (FCII_IDENTIFICATOR)glob.COMP_ID(0);
		JFrame frame = new JFrame();
		frame.getContentPane().add(new GInterfacesPanel(new GInterfaceTerminal(cid.WORD_USER())));
		frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		frame.pack();
		frame.setVisible(true);
	}
	
	public GInterfacesPanel() {
		super();
		initGUI();
	}
	public GInterfacesPanel(GInterfaceTerminal git) {
		super();
		num_int = git.getInterface().Number()*git.getInterface().Repeat();
		gInterfaceTerminals = git.getTerminalsVector();
		initGUI();
	}
	
	private void initGUI() {
		try {
			this.setPreferredSize(new java.awt.Dimension(399, 70));
			this.setLayout(null);
	
			{
				jScrollPane = new JScrollPane();
				this.add(jScrollPane);
//				jScrollPane.setBounds(0, 0, 385, 35);
				{
					jPanel1 = new JPanel();
					BoxLayout jPanel1Layout = new BoxLayout(
						jPanel1,
						javax.swing.BoxLayout.Y_AXIS);
					jPanel1.setLayout(jPanel1Layout);
					jScrollPane.setViewportView(jPanel1);
//					jPanel1.setPreferredSize(new java.awt.Dimension(364, 29));
					{
						for (int i=0; i<num_int;i++) {
							jPanel1.add(gInterfaceTerminals.get(i));
						}
					}
				}
			}
		} catch (Exception e) {
			log.error("", e);
		}
	}

	public JScrollPane getTerminalsScrollPane() {
		return jScrollPane;
	}

}
